[% setvar title Less line noise - let's get rid of @% %]
<div id="archive-notice">
    <h3>This file is part of the Perl 6 Archive</h3>
    <p>To see what is currently happening visit <a href="http://www.perl6.org/">http://www.perl6.org/</a></p>
</div>
<div class='pod'>
<a name='TITLE'></a><h1>TITLE</h1>
<p>Less line noise - let's get rid of @%</p>
<a name='VERSION'></a><h1>VERSION</h1>
<pre>  Maintainer: Karl Glazebrook &lt;<a href='mailto:kgb@pha.jhu.edu'>kgb@pha.jhu.edu</a>&gt;
  Date: 15 Aug 2000
  Last Modified: 28 Aug 2000
  Mailing List: <a href='mailto:perl6-language@perl.org'>perl6-language@perl.org</a>
  Number: 109
  Version: 2
  Status: Withdrawn</pre>
<a name='ABSTRACT'></a><h1>ABSTRACT</h1>
<p>This RFC proposes that <code>$x</code>, <code>@x</code>, and <code>%x</code> be ditched and
replaced with <code>$x</code> for everything.</p>
<p>I withdrew it on 28th August as I figured I had lost the
argument!</p>
<a name='DESCRIPTION'></a><h1>DESCRIPTION</h1>
<p>Back in the days of yore, Larry had a dream of a simple
typeless language. Variables were 'things', they could
hold numbers or strings, and manipulated without much
caring. The only important distinctions were whether they
were lists of things or hashes of things for which was
introduced the compact notation of <code>@</code> and <code>%</code>. Perl4 was
the anti-object-oriented language in an age when there
were Real Computers and Bill Gates was still trying to
flog BASIC.</p>
<p>Those days are gone. Perl 5 introduced the idea of Objects
and now any variable can be one of ten million possible
types all of very different behaviours.</p>
<p>Also in modern programming, lists are not longer simple
lists, neither are hashes, we have multidimensional arrays,
FIFO stacks, LIFO stacks, semi-infinite lists, etc. Basically there
are innumerable ways of containing things and they are usually
represented by objects.</p>
<p>I argue in this Brave New World the distinction between <code>$x</code>, <code>@x</code>
and <code>%x</code> are no longer useful and should be abolished. We might want
to use all kinds of array objects, why should @x be special? Rather
since there are infinitely many kinds of variable let's take the perl6
opportunity to make things simple and just use <code>$x</code> for everything.</p>
<p>A RFC by Andy Wardley proposes `Highlander Variable Types' (`there can
only be one'). This addresses the same fundamental issues, but retains
<code>@x</code> and <code>%x</code> in the interests of backwards compatibility.</p>
<p>My proposal goes further: there should be NO  <code>@x</code> and <code>%x</code>, only
<code>$x</code>.  This would make for a simplification of the language with
extreme prejudice.</p>
<a name='PROPOSAL:'></a><h1>PROPOSAL:</h1>
<p>All variables should be <code>$x</code>. They should behave appropriately
according to their object types and methods. ARRAY objects
and HASH objects would provide methods (inline, optimised
of course) to make $x[42] and $x{Fred} do the right thing.
See the pdl-porters RFC on 'default methods' for elegant
ways to do this.</p>
<p>The only distinction left would be between things which are
variables (prefixed by <code>$</code>) and not-variables (subroutines and
keywords).</p>
<a name='IMPLEMENTATION DETAILS'></a><h1>IMPLEMENTATION DETAILS</h1>
<p>Considerable I expect. :)</p>
<p>Overloading should happen everywhere.</p>
<pre>  print $x</pre>
<p>Ought to use string overloading and be able to print an array or hash
depending on type.</p>
<p>Similarly accesses such as <code>$x[42]</code> or <code>$x{Fred}</code> should function via
overloaded <code>[]</code> and <code>{}</code> operators.</p>
<pre>  $y = $x + 1 </pre>
<p>Ought to be able to execute appropriate code whether $x is a scalar, a
Perl array or a PDL array.</p>
<a name='REFERENCES'></a><h1>REFERENCES</h1>
<p>PDL RFC on 'Default Methods' - PDL RFCs coming Real Soon Now</p>
<p>RFC 9: Highlander Variable Types</p>
</div>
